<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-2.1.0.js"></script>
</head>
<body>
    <input type="button" value="发送Ajax跨域请求" onclick="send_ajax();"><br>
<!--    <h1 id="h"></h1>-->
    <script>
        function send_ajax() {
            $.ajax({
                //被访问方8081的controller上需加
                // @CrossOrigin(origins = "http://localhost:8080",allowCredentials = "true")
                //表示允许接收来自8080的请求
                url:"http://localhost:8081/a",
                success:function (ret) {
                    //将返回结果打印

                    // return "<span>"+ret+"</span>";
                    // $("#h").html(ret);
                    console.log(ret);
                }
            });

        }
    </script>
</body>
</html>